package br.com.abril.job;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository
public interface JobRepository 
				extends JpaRepository<Job, Long>
					  , JpaSpecificationExecutor<Job> {

	List<Job> findByTemplateTrue();
	
	List<Job> findByTemplateFalseAndActiveTrue();	

	@Query("from Job j where j.template = false and j.active = true and status = 'CREATED'")
	List<Job> findAvailableToSchedule();	
	
}

